﻿$(document).ready(function () {
    $('a.delete').click(function (event) {
        event.preventDefault();

        var url = event.target.href;
        $.fx.speeds._default = 350;
        $('#dialog').css('visibility', 'visible').dialog(
            {
                open: function() { $(this).parents('.ui-dialog-buttonpane button:eq(1)').focus(); },
                buttons:
                   {
                       'Yes': function () { $(this).dialog('close'); window.location.replace(url); },
                       'No': function () { $(this).dialog('close'); }
                   },
                closeOnEscape: false,
                modal: true,
                resizable: false,
                show: 'fade',
                hide: 'fold'
            });
    });
});

function DisplayDialog (message) {

    $.fx.speeds._default = 350;
    
    var dialogObject = $('#dialog');
    dialogObject.text(message);
    dialogObject.css('visibility', 'visible').dialog(
    {
        buttons:
            {
                'OK': function () { $(this).dialog('close'); }
            },
        modal: true,
        resizable: false,
        show: 'fade',
        hide: 'clip'
    });
}